﻿using System.Windows.Controls;
using IMClient.Model.UI;
using IMClient.ViewModels;

namespace IMClient.View
{
    /// <summary>
    /// ContactsPageFriendsList.xaml 的交互逻辑
    /// </summary>
    public partial class ContactsPageFriendsList : UserControl
    {
        public ContactsPageFriendsList()
        {
            InitializeComponent();
        }
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // 获取当前选中的好友
            if (DataContext is ContactsPageFriendsListViewModel viewModel && sender is ListView listView)
            {
                var selectedFriend = listView.SelectedItem as FriendViewModel;

                // 更新 ViewModel 的 SelectedFriend 属性
                viewModel.SelectedFriend = selectedFriend;

                // 触发显示好友详情逻辑（如果需要）
                viewModel.ShowFriendDetailsCommand.Execute(null);
            }
        }
    }
}
